package com.nbsaas.boot.site.rest.convert;

import com.nbsaas.boot.site.data.entity.DynamicPageCatalog;
import com.nbsaas.boot.site.api.domain.request.DynamicPageCatalogRequest;

import org.springframework.beans.BeanUtils;
import com.nbsaas.boot.rest.api.Converter;
import com.nbsaas.boot.utils.BeanDataUtils;
            import com.nbsaas.boot.site.data.entity.DynamicPageCatalog;

/**
* 页面分类请求对象转换成实体对象
*/

public class DynamicPageCatalogEntityConvert  implements Converter<DynamicPageCatalog, DynamicPageCatalogRequest> {

    @Override
    public DynamicPageCatalog convert(DynamicPageCatalogRequest source) {
        DynamicPageCatalog result = new DynamicPageCatalog();
        BeanDataUtils.copyProperties(source, result);
                    if(source.getParent()!=null){
                    DynamicPageCatalog parent =new DynamicPageCatalog();
                    parent.setId(source.getParent());
                    result.setParent(parent);
                    }
        return result;
    }
}

